package com.aerilys.taskboard.client.activities;

import com.aerilys.taskboard.client.places.AddTaskViewPlace;
import com.aerilys.taskboard.client.places.DetailsViewPlace;
import com.aerilys.taskboard.client.tools.ClientFactory;
import com.aerilys.taskboard.client.views.AddTaskView;
import com.aerilys.taskboard.client.views.DetailsView;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;

public class AddTaskActivity extends AbstractActivity implements AddTaskView.Presenter
{
  private ClientFactory clientFactory;
  private AddTaskViewPlace place;

  public AddTaskActivity(AddTaskViewPlace place, ClientFactory clientFactory)
  {
    this.place = place;
    this.clientFactory = clientFactory;
  }
  
  @Override
  public void start(AcceptsOneWidget panel, EventBus eventBus)
  {
    AddTaskView addView = clientFactory.getAddTaskView();
    addView.setPresenter(this);
    panel.setWidget(addView.asWidget());
  }

  @Override
  public void goTo(Place place)
  {
    clientFactory.getPlaceController().goTo(place);
  }

}
